import request from '_utils/request'

// 请求分类列表
const fetchCateLists = (params = {}) => (
  request.post('/cateLists', params)
)
// 增加商品分类
const addCate = (params = {}) => (
  request.post('/cateAdd', params)
)
// 获取商品分类详情
const fetchCateDetail = id => (
  request.get('/getCateDetail', { params: { id } })
)
// 修改商品分类
const updateCate = (params = {}) => (
  request.put('/updateCate', params)
)
// 获取商品列表
const fetchItems = (params = {}) => (
  request.get('/getItemLists', { params })
)
// 删除商品分类
const delCate = id => (
  request.delete('/delCate', { params: { id } })
)
// 删除商品
const delItem = id => (
  request.delete('/delItem', { params: { id } })
)
// 新增商品
const addItem = (params = {}) => (
  request.post('/addItem', params)
)
// 获取商品详情
const getItemDetail = id => (
  request.get('/getItemDetail', {
    params: { id }
  })
)
// 更新商品
const updateItem = (params = {}) => (
  request.put('/updateItem', params)
)
// 用户登录接口
const userLogin = (params = {}) => (
  request.post('/login', params)
)
export {
  fetchCateLists,
  addCate,
  fetchCateDetail,
  updateCate,
  fetchItems,
  delCate,
  delItem,
  addItem,
  getItemDetail,
  updateItem,
  userLogin
}
